<script>
    function safeSetGlobalMessage(strMessage)
    {
        var proofOfEndUserEnvironment= document.getElementById('runningInEndUserLoginEnvironment');
        if (proofOfEndUserEnvironment)
        {
            setGlobalMessage(strMessage);
        }
    }

    function submitForm()
    {
        var userNameEditBox = document.getElementById('Ecom_User_ID');
        var passwordEditBox = document.getElementById('Ecom_Password');
        if ((null != userNameEditBox) && (null != passwordEditBox))
        {
            if ((0 == userNameEditBox.value.length) || (0 == passwordEditBox.value.length))
            {
                safeSetGlobalMessage("Please enter values for the user name and password.");
                userNameEditBox.focus();
                return;
            }

            //if recaptcha is enabled just let the recaptcha code submit the document after verification


            // Get some values from elements on the page:
            var form = document.getElementById('IDPLogin');
            var url = form.action;

            safeSetGlobalMessage("Validating credentials...");

            var proofOfEndUserEnvironment= document.getElementById('runningInEndUserLoginEnvironment');
            if (proofOfEndUserEnvironment)
            {
                url = updateQueryString("uiDestination", "contentDiv", url);

                // Send the data using post
                var posting = $.post( url, $("#IDPLogin" ).serialize());

                // Put the results in a div
                posting.done(function( data )
                {
                    safeSetGlobalMessage("");
                    $('#theNidpContent').html(data);
                });

                posting.fail(function()
                {
                    safeSetGlobalMessage("Error communicating with the identity server");
                });
            }
            else
            {
                document.IDPLogin.submit();
            }
        }
    }


    function submitForm2() {
        // Get some values from elements on the page:
        var form = document.getElementById('IDPLogin');
        var url = form.action;

        safeSetGlobalMessage("Validating credentials...");

        var proofOfEndUserEnvironment= document.getElementById('runningInEndUserLoginEnvironment');
        if (proofOfEndUserEnvironment)
        {
            url = updateQueryString("uiDestination", "contentDiv", url);

            // Send the data using post
            var posting = $.post( url, $("#IDPLogin" ).serialize());

            // Put the results in a div
            posting.done(function( data )
            {
                safeSetGlobalMessage("");
                $('#theNidpContent').html(data);
            });

            posting.fail(function()
            {
                safeSetGlobalMessage("Error communicating with the identity server");
            });
        }
        else
        {
            document.IDPLogin.submit();
        }
    }

    function onLoadFocus()
    {
        if (document.IDPLogin.Ecom_User_ID.value)
        {
            document.IDPLogin.Ecom_Password.focus();
        }
        else
        {
            document.IDPLogin.Ecom_User_ID.focus();
        }
    }

    $(document).ready(function(){

        onLoadFocus();

        $( "#loginButton2" ).click(function()
        {
            submitForm();
        });

        $( "#loginButton2" ).keyup(function(event)
        {
            if (isEnterKey(event) || isSpaceKey(event))
            {
                submitForm();
            }
        });

        $("#Ecom_User_ID").keyup(function(event)
        {
            if (isEnterKey(event))
            {
                if (document.IDPLogin.Ecom_User_ID.value)
                {
                    $("#loginButton2").click();
                    return false;
                }
            }
            return true;
        });

        $("#Ecom_Password").keyup(function(event)
        {
            if (isEnterKey(event))
            {
                if (document.IDPLogin.Ecom_User_ID.value)
                {
                    $("#loginButton2").click();
                    return false;
                }
            }
            return true;
        });
    });

</script>



<form id="IDPLogin" name="IDPLogin" enctype="application/x-www-form-urlencoded" method="POST"
      action="https://login.authbridge.somegroup.com/nidp/app/login?sid=0&sid=0" AUTOCOMPLETE="off">
    <input type="hidden" name="option" value="credential">


    <div id="namepassword" class="content login-page" style="margin: 25px; display: block;">
        <div class="signin-div">
            <div class="input-signin-username">
                <input type="text" id="Ecom_User_ID" name="Ecom_User_ID" value="" tabindex="1" placeholder="Username"></div>
        </div>
        <div class="signin-div">
            <div class="input-signin-password">
                <input type="password" id="Ecom_Password" name="Ecom_Password" tabindex="2" placeholder="Password"></div>
        </div>





        <div class="closure-but signin-div">
            <span class="nam-signin-but action-but" name="loginButton2" id="loginButton2" tabindex="3">Sign in</span>
        </div>
    </div>

    <table border=0 style="margin-top: 1em" width="100%" cellspacing="0" cellpadding="0">



    </table>
</form>
